import {useRef,useState} from 'react'
import GrandSon from './GrandSon'
export default function Son({fatherData,onChangeData}){
    const inputRef= useRef(null)
    const [sonValue,setSonValue]=useState('')
    function print(){
        onChangeData(sonValue)
    }
    return (
        <div>
            <input placeholder={fatherData} ref={inputRef} onChange={(event)=>setSonValue(event.target.value)}></input>
            <button onClick={print}>传递</button>
            <GrandSon></GrandSon>
        </div>
    )
}
  
